package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	AttributeValueEventNew           = "wms.AttributeValueNew"
	AttributeValueEventBeforeCreate  = "wms.AttributeValueBeforeCreate"
	AttributeValueEventBeforeUpdate  = "wms.AttributeValueBeforeUpdate"
	AttributeValueEventBeforeSave    = "wms.AttributeValueBeforeCreate wms.AttributeValueBeforeUpdate"
	AttributeValueEventAfterCreate   = "wms.AttributeValueAfterCreate"
	AttributeValueEventAfterUpdate   = "wms.AttributeValueAfterUpdate"
	AttributeValueEventAfterSave     = "wms.AttributeValueAfterCreate wms.AttributeValueAfterUpdate"
	AttributeValueEventDelete        = "wms.AttributeValueDelete"
	AttributeValueAccessControlEvent = "wms.AttributeValueAccessControl"
)

func GetAttributeValueConfig() *mgo.DocConfig {
	return AttributeValue_Config
}

var AttributeValue_Config *mgo.DocConfig

func init() {
	AttributeValue_Config = NewAttributeValueConfig()
}
func NewAttributeValueConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "wms.AttributeValue",
		Fields: []string{
			"k", "itemBase", "name", "sort", "code", "note", "isOn",
		},
		RelationFields: []string{
			"k", "itemBase",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"k": {
				Config:     GetAttributeKeyConfig,
				DocName:    "AttributeKey",
				JoinType:   "O",
				KeyInside:  "kId",
				KeyOutSide: "id",
			},
			"itemBase": {
				Config:     GetItemBaseConfig,
				DocName:    "ItemBase",
				JoinType:   "O",
				KeyInside:  "itemBaseId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
